import request from "@/utils/request"; //导入封装请求的js文件

export function fetchOrderList(data) {
  return request({
    url: `/umsAdminOrder/selectOrderPage`,
    method: "post",
    data,
  });
}
//获取商品详情
export function selectAllByParams(params) {
  return request({
    url: `/omsOrder/selectAllByParams`,
    method: "get",
    params: params,
  });
}
//获取所有店铺
export function selectStoreNAmByParams(params) {
  return request({
    url: `/omsOrder/selectStoreNAmByParams`,
    method: "get",
    params: params,
  });
}
//获取所有售后订单
export function fetchAfterSaleOrderList(data) {
  return request({
    url: `/umsAdminOrder/selectReturnOrderPage`,
    method: "post",
    data,
  });
}
export function postOrderDelivery(data) {
  return request({
    url: `/umsAdminOrder/orderDelivery`,
    method: "post",
    data,
  });
}

// 导出订单
export function postExportOrder(data) {
  return request({
    url: `/umsAdminOrder/export`,
    method: "post",
    data,
    responseType: "blob", // 必填项
    headers: {
      responseType: "blob",
    },
  });
}

export function postAgreeOrderReturn(ids) {
  return request({
    url: `/umsAdminOrder/returnOrderTure`,
    method: "post",
    params: { ids },
  });
}

export function postRefuseOrderReturn(id, rejectReason) {
  return request({
    url: `/umsAdminOrder/returnOrderFalse`,
    method: "post",
    data: { id, rejectReason }
  });
}

export function fetchExpressList(id) {
  return request({
    url: "/kuaidi100/findOrder?id=" + id,
    method: "get",
  });
}
export function fetchExpressCompanyList() {
  return request({
    url: "/omsOrderExpress",
    method: "get",
  });
}

export function postReceiveGoods(id) {
  return request({
    url: "/umsAdminOrder/adminReceipt",
    method: "post",
    params: { id },
  });
}

export function postRefundMoney(id, sid) {
  return request({
    url: '/payment/weixin/reviewRefund/' + id + '/' + sid,
    method: 'get'
  })
}

export function postAgreeReplenishment(id) {
  return request({
    url: '/umsAdminOrder/reissueTure',
    method: 'post',
    params: { id }
  })
}

export function postAgreeExchange(id) {
  return request({
    url: '/umsAdminOrder/exchangeGoodsTure',
    method: 'post',
    params: { id }
  })
}
